/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.delogic.simuladorBancario;

import java.util.Scanner;

/**
 *
 * @author user
 */
public class Termometro {

    private String descricao;
    private int temperatura;
    public final int TEMPERATURA_MAXIMA = 100;
    public final int TEMPERATURA_MINIMA = -30;

    public Termometro() {
        lerDescricao();
        lerTemperatura();
    }

    
    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String desc) {
        this.descricao = desc;
    }

    public int getTemperatura() {
        return temperatura;
    }

    public void setTemperatura(int temp) {
        if (temp >= TEMPERATURA_MINIMA && temp <= TEMPERATURA_MAXIMA) {
            this.temperatura = temp;
        }else{
            System.out.println("Temperatura Maxima: "+TEMPERATURA_MAXIMA);
            System.out.println("Temperatura Minima: "+TEMPERATURA_MINIMA);
        }
    }

    
    
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder = stringBuilder.append("Descrição: "+getDescricao());
        stringBuilder = stringBuilder.append(" /Temperatura: "+getTemperatura());
        stringBuilder = stringBuilder.append(" /Temperatura Fahrenheit: "+getTemperaturaEmFahrenheit());
        stringBuilder = stringBuilder.append(" /Temperatura Kelvin: "+getTempretaturaEmKelvin());
        
        return stringBuilder.toString();
    }
    public void lerTemperatura(){
        Scanner scanner = new Scanner(System.in);
        System.out.print("Digite a temperatura: ");
        setTemperatura(Integer.parseInt(scanner.nextLine()));
    }
    public void lerDescricao(){
        Scanner scanner = new Scanner(System.in);
        System.out.print("Digite a descrição do Termometro: ");
        this.descricao = scanner.nextLine();
    }
    public double getTemperaturaEmFahrenheit() {
        return getTemperatura()* 1.8 + 32;
    }
    public float getTempretaturaEmKelvin(){
        return (float) (getTemperatura()+773.15);
    }
}
